home *** CD-ROM | disk | FTP | other *** search
- Path: newshost.lanl.gov!tanmoy
- From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
- Newsgroups: comp.lang.c
- Subject: Re: argc/argv & switches
- Date: 07 Mar 1996 15:09:09 GMT
- Organization: Los Alamos National Laboratory
- Message-ID: <TANMOY.96Mar7080909@qcd.lanl.gov>
- References: <4h2j8j$9gn@milo.freenet.vancouver.bc.ca> <danpop.825593142@rscernix>
- <313E0094.167EB0E7@fore.com> <4hl52oINNa4l@anvil.ugrad.cs.ubc.ca>
- NNTP-Posting-Host: qcd.lanl.gov
- Mime-Version: 1.0
- Content-Type: text
- In-reply-to: c2a192@ugrad.cs.ubc.ca's message of 6 Mar 1996 14:54:16 -0800
-
- In article <4hl52oINNa4l@anvil.ugrad.cs.ubc.ca>
- c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku) writes:
-
- <snip>
- KK: > The parameters argc and argv and the strings pointed
- KK: > to by the argv array shall be modifiable by the program....
- KK:
- KK: But argv[0] is not the argv parameter, but the first pointer pointed at by
- KK: argv. That the strings are modifiable doesn't necessarily imply that the
- KK: array of pointers through which these strings are accessed is itself
- KK: modifiable.
- KK:
- KK: However, if it were the case that these pointers are not
- modifiable, would not
- KK: the declaration of main() be required to be written as:
- KK:
- KK: int main(int argc, char * const *argv)
- KK:
- KK: or
- KK:
- KK: int main(int argc, char * const argv[])
- KK:
- KK: That is, ``argv is a pointer to a vector of constant pointers to modifiable
- KK: chars''.
-
- No. No such `requirement' ensues. Compare that string literals have
- a type char[], not const char[], and yet are not modifiable. Some
- compromise because of history is unavoidable, thought they are
- unfortunate.
-
- Cheers
- Tanmoy
- --
- tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
- Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
- Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
- <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
- internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
- fax: 1 (505) 665 3003 voice: 1 (505) 665 4733 [ Home: 1 (505) 662 5596 ]
-